﻿<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="chrome=1">
    <title>Auto Number Manager for XrmToolBox</title>
    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">

    <link rel="stylesheet" href="stylesheets/styles.css">
    <link rel="stylesheet" href="stylesheets/pygment_trac.css">
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <!--    <script type="text/javascript" src="javascripts/showdown.js"></script>-->
    <script type="text/javascript" src="javascripts/rappen-gh-api.js"></script>
    <script type="text/javascript" src="javascripts/rappen-repo-counter.js"></script>



    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <!--[if lt IE 9]>
    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <script>
        var GH_USER = "rappen";
        var GH_REPO = "AutoNumManager";
        var NUGET_PACKAGE = "Rappen.XrmToolBox.AutoNumManager";
        var nugetInfo = null;
        var githubInfo = null;
        var nugetLoading = false;
        var githubLoading = false;
        var versionInfo = null;

        var releasenotesshowing = false;
        var releasenotesloaded = false;
        var historyshowing = false;
        var historyloaded = false;

        $(document).ready(function () {
            UpdateRelease();
            //LoadPeople("stargazers", "gazers", 3);
            //LoadPeople("subscribers", "watchers", 3);
            LoadIssues("issues-open", "issues-total");
        });

        UpdateRelease = function () {
            if (!nugetLoading) {
                nugetInfo = null;
                githubInfo = null;
                nugetLoading = true;
                $("#latest-version").text("Loading stats...");
                $("#latest-published").text("...from NuGet");
                $("#latest-downloads").text("");
                $("#total-downloads").text("");
                $("#hist-downloads").text("");
                $("#showhide-hist").text("+");
                historyshowing = false;
                historyloaded = false;
                NugetGetDetails(NUGET_PACKAGE, NuGetInfoRetrieved, InfoLoadError);
            }
        }

        NuGetInfoRetrieved = function (info) {
            nugetInfo = info;
            if (githubInfo) {
                var details = CombineDetails(nugetInfo, githubInfo, true);
                PrintVersionInfo(details);
            }
            else if (!githubLoading) {
                githubLoading = true;
                $("#latest-version").text("Loading stats...");
                $("#latest-published").text("...from GitHub");
                GitHubGetDetails(GH_USER, GH_REPO, GitHubInfoRetrieved, InfoLoadError);
            }
            nugetLoading = false;
        }

        GitHubInfoRetrieved = function (info) {
            githubInfo = info;
            if (nugetInfo) {
                versionInfo = CombineDetails(nugetInfo, githubInfo, true);
                PrintVersionInfo(versionInfo);
            }
            githubLoading = false;
        }

        InfoLoadError = function (xhr, options, error) {
            $("#latest-downloads").text("Error: " + error);
        }

        PrintVersionInfo = function (info) {
            $("#latest-version").text(info.latestVersion.version);
            $("#latest-downloads").text(info.latestVersion.downloads);
            $("#total-downloads").text(" (" + info.totalDownloads + ")");
            var date = info.latestVersion.published;
            if (!date) {
                $(info.versions).each(function (index) {
                    if (!date && this.published) {
                        date = this.published;
                    }
                });
            }
            if (date) {
                date = new Date(date);
                $("#latest-published").text(date.toFormattedString('yyyy-mm-dd'));
            }
            else {
                $("#latest-published").text("Not available");
            }
        }

        PrintHistoryInfo = function (info, callback) {
            var counttext = "<u>Version&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Count&nbsp;&nbsp;Released&nbsp;&nbsp;</u><br />";
            $(info.versions).each(function (index) {
                var link = "";
                if (this.url) {
                    link = this.url;
                }
                else if (this.host == "NuGet") {
                    link = 'http://nuget.org/packages/' + NUGET_PACKAGE + '/' + this.version;
                }
                var tag = this.version.padRight(13);
                if (link) {
                    tag = '<a href="' + link + '" target=_"blank" alt="' + this.host + '">' + tag + '</a>';
                }
                if (this.published) {
                    var date = new Date(this.published);
                    date = "&nbsp;&nbsp;" + date.toFormattedString('yyyy-mm-dd ');
                }
                else {
                    date = "&nbsp;&nbsp;<em>" + this.host + "</em>";
                }
                var count = this.downloads;
                counttext += tag + " <strong>" + count.padLeft(5, '&nbsp;') + "</strong>" + date + "<br/>";
            });
            if (GH_REPO == "FetchXMLBuilder") {
                counttext += GetCodePlexDownloads(true);
            }
            counttext += "";
            $("#hist-downloads").html(counttext);
            if (callback) {
                callback();
            }
        }

        ShowHideReleaseNotes = function () {
            if (releasenotesshowing) {
                $("#release-notes").hide(200);
                $("#showhide-releasenotes").text("Show");
                releasenotesshowing = false;
            }
            else {
                if (!releasenotesloaded) {
                    $("#showhide-releasenotes").text("loading");
                    $("#release-notes").hide(0);
                    UpdateReleaseNotes("release-notes", ShowHideReleaseNotes);
                    releasenotesloaded = true;
                }
                else {
                    $("#release-notes").show(200);
                    $("#showhide-releasenotes").text("Hide");
                    releasenotesshowing = true;
                }
            }
        };

        ShowHideDownloadHistory = function () {
            if (historyshowing) {
                $("#hist-downloads").hide(200);
                $("#showhide-hist").text("+");
                historyshowing = false;
            }
            else {
                if (!historyloaded) {
                    $("#showhide-hist").text("loading");
                    $("#hist-downloads").hide(0);
                    historyloaded = true;
                    PrintHistoryInfo(versionInfo, ShowHideDownloadHistory);
                }
                else {
                    $("#hist-downloads").show(100);
                    $("#showhide-hist").text("-");
                    historyshowing = true;
                }
            }
        };
    </script>
</head>

<body>
    <div class="wrapper">
        <div class="row">
            <div class="col-xs-12 col-sm-4 col-lg-3">
                <h1 onclick="window.location = 'http://anm.xrmtoolbox.com';" style="cursor:pointer;">
                    <img src="images/ANM-About-400.png" /><br />
                </h1>
                <p>
                    <br />
                    <br />
                    <br />
                    <strong>
                        "An <a href="http://www.xrmtoolbox.com">XrmToolBox</a>
                        plugin to manage the Auto Number features introduced for Microsoft Dynamics 365, October 2017."
                    </strong>
                </p>
                <p align="right">
                    <i>- Jonas Rapp</i>
                </p>
                <hr />
            </div>
            <div class="col-xs-12 col-sm-8 col-lg-6">
                <h3>
                    <a id="introduction" class="anchor" href="#introduction" aria-hidden="true"><span class="octicon octicon-link"></span></a>Introduction
                </h3>
                <p>
                    <em>
                        The primary goal of the tool is to give Microsoft Dynamics 365 customizers a way of managing Auto Number attributes.
                        This feature was introduced with the 9.0 release from October 2017.
                        However, this release only supports creating and managing these attributes through the SDK.
                        A user interface for the features is expected to be available from the 9.1 release of the platform.<br />
                        With the Auto Number Manager for XrmToolBox you can create, alter and delete these attributes through an easy to use UI.
                    </em>
                </p>
                <center>
                    <hr width="50%" />
                    <strong>
                        Read more about the features for auto numbers and the technology behind it in blog post<br />
                        <a href="https://jonasrapp.net/2017/10/anm/" target="_blank">Auto Number attributes in Microsoft Dynamics 365</a>
                    </strong>
                    <br /><br /><hr width="50%" />
                </center>
                <img src="images/ANM-screen.jpg">

                <hr />

                <h3>
                    <a id="info" class="anchor" href="#info" aria-hidden="true"><span class="octicon octicon-link"></span></a>How-to
                </h3>
                <p>
                    <h4>Solution</h4>
                    <img src="images/ANM-solution.jpg">
                    <br />
                    The Solution dropdown will display all available unmanaged solutions in the system.<br />
                    Select the solution in which to work with auto number attributes.<br />
                    The prefix of the publisher of the solution will be used for new attributes created.
                    <br /><br />
                    <h4>Entity</h4>
                    <img src="images/ANM-entity.jpg">
                    <br />
                    The Entity dropdown will display all entities included in the selected solution.<br />
                    Select the entity for which to work with auto number attributes.
                    <br /><br />
                    <h4>New Attribute</h4>
                    Click this button to create a new Auto Number attribute for the selected entity in the selected solution.
                    <br /><br />
                    <h4>Existing attributes</h4>
                    <img src="images/ANM-attributes.jpg">
                    <br />
                    The table will display logical name and auto number format for existing auto number attributes on the selected entity.<br />
                    Select an attribute to view the attribute properties, and to update properties or seed (next value to assign).
                    <br /><br />
                    <h4>Attribute properties</h4>
                    <img src="images/ANM-attribute.jpg">
                    <br />
                    This box contains all properties relevant to auto number attributes.
                    <ul>
                        <li>
                            <strong>Logical Name</strong><br />
                            This can only be entered for new attributes. Prefix is taken from the publisher of the selected solution.
                        </li>
                        <li>
                            <strong>Display Name</strong><br />
                            The display name in the locale of the current user. See property Language Id below.
                        </li>
                        <li>
                            <strong>Description</strong><br />
                            The description of the attribute in the locale of the current user. See property Language Id below.
                        </li>
                        <li>
                            <strong>Maximum Length</strong><br />
                            The max length of the attribute. Note that the length must be equal to or greater than the length of the resulting number! If too short, it will not be possible to create records.
                        </li>
                        <li>
                            <strong>Language Id</strong><br />
                            The language for which to create or update Display Name and Description. This field is pre populated based on current user's settings.
                        </li>
                        <li>
                            <strong>Number Format</strong><br />
                            This is where the magic happens.<br />
                            The format can contain any text or characters, and must contain one placeholder for sequential number.<br />
                            The format can contain one or more placeholders for random strings and date/time string.<br />
                            To delete a number format, clear this field and check the <em>Don't require SEQNUM</em> box.<br />
                            See samples below.
                        </li>
                        <li>
                            <strong>Don't require SEQNUM</strong><br />
                            <em>Added after screenshot was made</em><br />
                            If this is checked, it is not required to include a SEQNUM component in the Number Format. This will NOT guarantee unique values!<br />
                            To delete a number format, check this box and clear the Number Format field.
                        </li>
                        <li>
                            <strong>Seed</strong><br />
                            The seed defines next sequence number to use.<br />
                            When creating a new attribute, this will be set to 1 in nothing is entered.<br />
                            When updating an existing attribte, this should be left empty, unless you specifically want to change the existing number series!<br />
                            <em>Note that updating the seed for an existing attribute MAY result in duplicated information for new records!</em>
                        </li>
                        <li>
                            <strong>Sample Number</strong><br />
                            This field will show a sample of the generated auto number, based on the information given above.
                        </li>
                    </ul>
                    <h4>Create / Update</h4>
                    Execute creation or update of the attribute with given properties.
                    <br /><br />
                    <h4>Delete</h4>
                    This will delete the attribute from the entity and data for existing records. This action is not possible to undo, data is LOST!
                    <br /><br />
                    <h4>Show data with FXB</h4>
                    Click this button to open <a href="http://fxb.xrmtoolbox.com">FetchXML Builder</a> with a query to get the last ten records for the selected entity, with primary name, created on, and any auto number attributes included.
                </p>
                <h3>
                    Samples
                </h3>
                <pre><strong>Number Format                                              Example value</strong>
CAR-{SEQNUM:3}-{RANDSTRING:6}                               CAR-123-AB7LSF
CNR-{RANDSTRING:4}-{SEQNUM:4}                               CNR-WXYZ-1000
{SEQNUM:6}-#-{RANDSTRING:3}                                 123456-#-R3V
KA-{SEQNUM:4}                                               KA-0001
{SEQNUM:10}                                                 1234567890
QUO-{SEQNUM:3}#{RANDSTRING:3}#{RANDSTRING:5}                QUO-123#ABC#PQ2ST
QUO-{SEQNUM:7}{RANDSTRING:5}                                QUO-0001000P9G3R
CAS-{SEQNUM:6}-{RANDSTRING:6}-{DATETIMEUTC:yyyyMMddhhmmss}  CAS-002000-S1P0H0-20170913091544
CAS-{SEQNUM:6}-{DATETIMEUTC:yyyyMMddhh}-{RANDSTRING:6}      CAS-002002-2017091309-HTZOUR</pre>
                <em>DateTime placeholders accepts <a href="https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings" target="_blank">Standard Date and Time format strings</a>.</em><br /><br />
                <h3>
                    Documentation
                </h3>
                <p>
                    Full SDK documentation is available here:
                    <a href="https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/create-auto-number-attributes" target="_blank">https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/create-auto-number-attributes</a>
                </p>
                <!--h3>
                <a id="gitter" class="anchor" href="#gitter" aria-hidden="true"><span class="octicon octicon-link"></span></a>Discussion
            </h3>
            <p>
                Click <strong>OPEN CHAT</strong> in the bottom right corner of this web page to ask questions, give feedback,
                or simply to join the discussion!
            </p>
            <div id="gitter_sidecar">
                <script>
                    ((window.gitter = {}).chat = {}).options = {
                        room: 'Rappen/AutoNumManager'
                    };
                </script>
                <script src="https://sidecar.gitter.im/dist/sidecar.v1.js" async defer></script>
            </div-->
                <h3>
                    <a id="cinteros" class="anchor" href="#cinteros" aria-hidden="true"><span class="octicon octicon-link"></span></a>Other XrmToolBox plugins from Jonas Rapp
                </h3>
                <table border="0">
                    <tr>
                        <td>
                            FetchXML Builder:
                        </td>
                        <td>
                            <a href="http://fxb.xrmtoolbox.com" target="_blank">fxb.xrmtoolbox.com</a>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Plugin Trace Viewer:
                        </td>
                        <td>
                            <a href="http://ptv.xrmtoolbox.com" target="_blank">ptv.xrmtoolbox.com</a>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Bulk Data Updater:
                        </td>
                        <td>
                            <a href="http://github.com/rappen/BulkDataUpdater" target="_blank">github.com/rappen/BulkDataUpdater</a>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Latebound Constants Generator:
                        </td>
                        <td>
                            <a href="http://github.com/rappen/LateboundConstantsGenerator" target="_blank">github.com/rappen/LateboundConstantsGenerator</a>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Related Records Analyzer:
                        </td>
                        <td>
                            <a href="http://github.com/rappen/RelatedRecordsAnalyzer" target="_blank">github.com/rappen/RelatedRecordsAnalyzer</a>
                        </td>
                    </tr>
                </table>
                <hr />
                <!--img src="http://s11.flagcounter.com/count2/hbd/bg_FFFFFF/txt_000000//border_D4D4D4/columns_5/maxflags_250/viewers_ANM+fan+base/labels_1/pageviews_0/flags_0/"
         alt="Flag Counter" border="0"-->
                <script>
                    (function (i, s, o, g, r, a, m) {
                        i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
                            (i[r].q = i[r].q || []).push(arguments)
                        }, i[r].l = 1 * new Date(); a = s.createElement(o),
                            m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
                    })(window, document, 'script', 'http://www.google-analytics.com/analytics.js', 'ga');
                    ga('create', 'UA-41153925-5', 'auto');
                    ga('send', 'pageview');
                </script>
                <br /> Visitor count for ANM, <a href="http://ptv.xrmtoolbox.com">PTV</a> and <a href="http://fxb.xrmtoolbox.com">FXB</a> since 2015-02-19:
                <!-- Start of StatCounter Code for Default Guide -->
                <a href="http://statcounter.com/p10300908/summary/" target="_blank">
                    <script type="text/javascript">
                        var sc_project = 10300908;
                        var sc_invisible = 0;
                        var sc_security = "d1d1a604";
                        var sc_text = 5;
                        var sc_https = 1;
                        var scJsHost = (("https:" == document.location.protocol) ? "https://secure." : "http://www.");
                        document.write("<sc" + "ript type='text/javascript' src='" + scJsHost + "statcounter.com/counter/counter.js'></" + "script>");
                    </script>
                </a>
                <!-- End of StatCounter Code for Default Guide -->

            </div>
            <div class="col-xs-12 col-sm-12 col-lg-3">
                <div>
                    <hr /> Run <a href="http://www.xrmtoolbox.com">XrmToolBox</a> and open the Plugin Store to get the latest version
                    of Auto Number Manager!
                    <br />
                    <br />
                </div>
                <table border="0">
                    <tr>
                        <th colspan="2" style="padding-top:10px;">
                            Latest release &nbsp;&nbsp;
                            <a href="https://github.com/Rappen/AutoNumManager/releases" target="_blank"><img src="images/open.png" /></a>
                        </th>
                    </tr>
                    <tr>
                        <td>Version</td>
                        <td id="latest-version">Loading version...</td>
                    </tr>
                    <tr>
                        <td>Publish date</td>
                        <td id="latest-published">Loading publish date...</td>
                    </tr>
                    <tr>
                        <td valign="top" style="border-bottom:0px;">
                            Downloads (total) &nbsp;&nbsp;
                            <a href="javascript:ShowHideDownloadHistory();" id="showhide-hist" title="Show download count by version">+</a>
                        </td>
                        <td valign="top" style="border-bottom:0px;">
                            <span id="latest-downloads">Loading download count...</span>
                            <span id="total-downloads"></span>
                            <span><a href="javascript:UpdateRelease();" title="Refresh counters"><img src="images/refresh.png" width="16" height="16" align="right" /></a></span>
                            <br />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" style="border-top:0px; padding:0 0 0 50px;">
                            <span id="hist-downloads" style="font-size:12px; line-height:0.9; font-family:'Courier'"></span>
                        </td>
                    </tr>
                    <!--<tr>
                        <td valign="top">
                            <strong>Release Notes&nbsp;&nbsp;&nbsp;&nbsp;</strong>
                            <a href="javascript:ShowHideReleaseNotes();" id="showhide-releasenotes">Show</a>
                        </td>
                        <td colspan="2"><div id="release-notes"></div></td>
                    </tr>-->
                    <tr>
                        <th colspan="2" style="padding-top:10px;">
                            Issues &nbsp;&nbsp;
                            <a href="https://github.com/Rappen/AutoNumManager/issues" target="_blank"><img src="images/open.png" /></a>
                        </th>
                    </tr>
                    <tr>
                        <td>
                            Open
                        </td>
                        <td>
                            <span id="issues-open"></span>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Total
                        </td>
                        <td>
                            <span id="issues-total"></span>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
        <footer>
            <p>
                <iframe src="https://ghbtns.com/github-btn.html?user=rappen&repo=AutoNumManager&type=star&count=true" frameborder="0"
                        scrolling="0" width="100px" height="20px"></iframe>
                <span id="gazers"></span>
                <iframe src="https://ghbtns.com/github-btn.html?user=rappen&repo=AutoNumManager&type=watch&count=true&v=2"
                        frameborder="0" scrolling="0" width="100px" height="20px"></iframe>
                <span id="watchers"></span>
                <!--<iframe src="https://ghbtns.com/github-btn.html?user=rappen&repo=AutoNumManager&type=fork&count=true" frameborder="0" scrolling="0" width="100px" height="20px"></iframe>-->
            </p>
            <p>
                <ul>
                    <li><a href="https://github.com/Rappen/AutoNumManager/issues">Go to <strong>Issues</strong></a></li>
                    <li><a href="https://github.com/Rappen/AutoNumManager">View on <strong>GitHub</strong></a></li>
                    <li><a href="https://www.nuget.org/packages/Rappen.XrmToolBox.AutoNumManager/">View on <strong>NuGet</strong></a></li>
                </ul>
            </p>
            <p>
                <a href="https://jonasrapp.net" target="_blank" title="Jonas Rapp blog"><img src="images/blogger.png" width="30" height="30" /></a>&nbsp;
                <a href="https://twitter.com/rappen" target="_blank" title="Jonas Rapp on Twitter"><img src="images/twitter.png" width="30" height="30" /></a>&nbsp;
            </p>
            <p>This project is developed and maintained by Jonas Rapp</p>
            <!--<p><small>Hosted on GitHub Pages &mdash; Theme by <a href="https://github.com/orderedlist">orderedlist</a></small></p>-->
        </footer>
    </div>
    <script src="javascripts/scale.fix.js"></script>

</body>

</html>
